import { Column, Entity, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';

@Entity('user')
export class User {
  @PrimaryGeneratedColumn({
    type: 'bigint',
    name: 'id',
    comment: '主键id',
  })
  id: bigint;

  @Column({
    type: 'varchar',
    default: '',
    nullable: false,
    length: 50,
    name: 'email',
    comment: '邮箱',
  })
  email: string;

  @Column({
    type: 'bigint',
    default: 1000,
    name: 'level',
    comment: '等级',
  })
  level: number;

  @Column({
    type: 'int',
    default: 0,
    name: 'count_level',
    comment: '计算等级',
  })
  countLevel: number;

  @Column({
    type: 'char',
    default: '0',
    name: 'state',
    comment: '登录状态',
  })
  state: string;
  @Column({
    type: 'varchar',
    default: '',
    length: 50,
    name: 'alias',
    comment: '别名',
  })
  alias: string;

  @Column({
    type: 'varchar',
    default: '',
    length: 50,
    name: 'username',
    comment: '用户名',
  })
  username: string;

  @Column({
    type: 'varchar',
    length: 100,
    name: 'password',
    select: false,
    comment: '密码',
  })
  password: string;
  @Column({
    type: 'varchar',
    default: '',
    name: 'avatar',
    comment: '头像',
  })
  avatar: string;

  @CreateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'create_time',
    comment: '创建时间',
  })
  createTime: Date;
}

export default User;
